public class Solution1945 {
    public int getLucky(String s, int k) {
        StringBuilder stringBuilder=new StringBuilder();
        for (char c : s.toCharArray()) {
            stringBuilder.append(c-'a'+1);
        }
        String n=stringBuilder.toString();
        for (int i = 0; i < k; i++) {
            int ans=0;
            for (char c : n.toCharArray()) {
                ans+=c-'0';
            }
            n=String.valueOf(ans);
        }
        return Integer.parseInt(n);
    }

    public static void main(String[] args) {
        System.out.println(new Solution1945().getLucky("iiii",1));
    }
}
